﻿using System.Configuration;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;

namespace iHouse.Model
{
    public class DataBaseSetup
    {
        //private Func<bool> setupPredict;

        public DataBaseSetup()
        {
            //setupPredict = DefaultPredict;
        }

        //public DataBaseSetup(Func<bool> predict)
        //{
        //    setupPredict = predict;
        //}

        //public void Execute()
        //{
        //    string cs = ConfigurationManager.ConnectionStrings["iHouseConnectString"].ToString();

        //    Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0", "", cs);
        //    Database.SetInitializer(new CreateDatabaseIfNotExists<iHouseDbContext>());
        //}

        //private bool DefaultPredict()
        //{
        //    string data = AppDomain.CurrentDomain.GetData("DataDirectory") as string;
        //    string file = Path.Combine(data, "iHouse.sdf");

        //    return !File.Exists(file);
        //}
    }
}
